/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package br.gov.cemaden.library.model.smp;

import br.gov.cemaden.library.model.BaseEntity;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import org.codehaus.jackson.annotate.JsonBackReference;

/**
 *
 * @author paulo.dias
 */
@Entity
@Table(name = "smp_memoria", schema = "smp")
@SequenceGenerator(name = "sequence", sequenceName = "smp.smp_memoria_sequence", schema = "smp")
@NamedQueries({
    @NamedQuery(name = "Memoria.findAll", query = "SELECT a FROM Memoria a ORDER BY a.id ASC"),
    @NamedQuery(name = "Memoria.findById", query = "SELECT a FROM Memoria a WHERE a.id = :id"),
    @NamedQuery(name = "Memoria.findByMemoryLivreTotalReal", query = "SELECT a FROM Memoria a WHERE a.memoryLivreTotalReal = :memoryLivreTotalReal"),
    @NamedQuery(name = "Memoria.findByMemoryUsadaTotalReal", query = "SELECT a FROM Memoria a WHERE a.memoryUsadaTotalReal = :memoryUsadaTotalReal"),
    @NamedQuery(name = "Memoria.findByMemoryTotalUtilizado", query = "SELECT a FROM Memoria a WHERE a.memoryTotalUtilizado = :memoryTotalUtilizado"),
    @NamedQuery(name = "Memoria.findByMemoryTotalLivre", query = "SELECT a FROM Memoria a WHERE a.memoryTotalLivre = :memoryTotalLivre"),
    @NamedQuery(name = "Memoria.findByMemoryRam", query = "SELECT a FROM Memoria a WHERE a.memoryRam = :memoryRam"),
    @NamedQuery(name = "Memoria.findByMemoryTotal", query = "SELECT a FROM Memoria a WHERE a.memoryTotal = :memoryTotal"),
    @NamedQuery(name = "Memoria.findByExecHardware", query = "SELECT a FROM Memoria a WHERE a.execHardware = :execHardware"),})
public class Memoria implements Serializable, BaseEntity {

    @Id
    @GeneratedValue(generator = "sequence", strategy = GenerationType.AUTO)
    @Column(name = "id_memoria", nullable = false, unique = true)
    private Long id;
    
    @Column(name = "memory_livre_total_real")
    private Double memoryLivreTotalReal;
    
    @Column(name = "memory_usada_total_real")
    private Double memoryUsadaTotalReal;
    
    @Column(name = "memory_total_utilizado")
    private Double memoryTotalUtilizado;
    
    @Column(name = "memory_total_livre")
    private Double memoryTotalLivre;
    
    @Column(name = "memory_ram")
    private Double memoryRam;
    
    @Column(name = "memory_total")
    private Double memoryTotal;
    
    @OneToOne
    @JsonBackReference
    @JoinColumn(name = "id_exec_hardware", referencedColumnName = "id_exec_hardware", unique = true)
    private ExecHardware execHardware;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public Double getMemoryLivreTotalReal() {
        return memoryLivreTotalReal;
    }

    public void setMemoryLivreTotalReal(Double memoryLivreTotalReal) {
        this.memoryLivreTotalReal = memoryLivreTotalReal;
    }

    public Double getMemoryUsadaTotalReal() {
        return memoryUsadaTotalReal;
    }

    public void setMemoryUsadaTotalReal(Double memoryUsadaTotalReal) {
        this.memoryUsadaTotalReal = memoryUsadaTotalReal;
    }

    public Double getMemoryTotalUtilizado() {
        return memoryTotalUtilizado;
    }

    public void setMemoryTotalUtilizado(Double memoryTotalUtilizado) {
        this.memoryTotalUtilizado = memoryTotalUtilizado;
    }

    public Double getMemoryTotalLivre() {
        return memoryTotalLivre;
    }

    public void setMemoryTotalLivre(Double memoryTotalLivre) {
        this.memoryTotalLivre = memoryTotalLivre;
    }

    public Double getMemoryRam() {
        return memoryRam;
    }

    public void setMemoryRam(Double memoryRam) {
        this.memoryRam = memoryRam;
    }

    public Double getMemoryTotal() {
        return memoryTotal;
    }

    public void setMemoryTotal(Double memoryTotal) {
        this.memoryTotal = memoryTotal;
    }

    public ExecHardware getExecHardware() {
        return execHardware;
    }

    public void setExecHardware(ExecHardware execHardware) {
        this.execHardware = execHardware;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 89 * hash + (this.id != null ? this.id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final Memoria other = (Memoria) obj;
        if (this.id != other.id && (this.id == null || !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Memoria{" + "id=" + id + ", memoryLivreTotalReal=" + memoryLivreTotalReal + ", memoryUsadaTotalReal=" + memoryUsadaTotalReal + ", memoryTotalUtilizado=" + memoryTotalUtilizado + ", memoryTotalLivre=" + memoryTotalLivre + ", memoryRam=" + memoryRam + ", memoryTotal=" + memoryTotal + ", execHardware=" + execHardware + '}';
    }
}
